package com.zhenmaitang.clinic_sys.service;

import com.zhenmaitang.clinic_sys.entity.User;
import com.zhenmaitang.clinic_sys.entity.Role;
import com.zhenmaitang.clinic_sys.dto.UserRegistrationRequest;

import java.util.List;

public interface UserService {
    
    User findByUsername(String username);
    
    User findById(Integer id);
    
    List<User> findAll();
    
    User createUser(UserRegistrationRequest request);
    
    User updateUser(User user);
    
    void deleteUser(Integer id);
    
    boolean existsByUsername(String username);
    
    boolean existsByEmail(String email);
    
    List<User> findUsersByDepartment(Integer departmentId);
    
    List<User> findUsersByRole(String role);
    
    void assignRoleToUser(Integer userId, Integer roleId, Integer departmentId);
    
    User createUserDirectly(User user);
    
    // 获取用户的角色
    List<Role> getUserRoles(Integer userId);
    
    // 为用户分配角色
    void assignRolesToUser(Integer userId, List<Integer> roleIds, Integer departmentId);
    
    // 获取用户的权限
    List<String> getUserPermissions(Integer userId);
    
    // 检查用户是否有指定权限
    boolean hasPermission(Integer userId, String permissionCode);
} 